package org.example.src.entity;

import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;

@Entity
@Table(name = "teachers")
@Data
@EqualsAndHashCode(callSuper = true)
public class Teacher extends User {
    @Id
    private Long userId;

    @OneToOne
    @MapsId
    @JoinColumn(name = "user_id")
    private User user;

    @Column(name = "teacher_id", unique = true)
    private String teacherId;

    @Column(name = "full_name")
    private String fullName;

    private String department;

    private String title;

    @Column(name = "office_location")
    private String officeLocation;

    @Column(name = "office_hours")
    private String officeHours;

    @OneToMany(mappedBy = "teacher", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    private List<Feedback> feedbacks;

    protected void onCreate() {
        super.onCreate();
        this.setRole("TEACHER");
    }

    protected void onUpdate() {
        super.onUpdate();
    }
}
